Integrand size = 15, antiderivative size = 68 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=-\frac {\cos (2 a-c+(2 b-d) x)}{4 (2 b-d)}-\frac {\cos (c+d x)}{2 d}+\frac {\cos (2 a+c+(2 b+d) x)}{4 (2 b+d)} \]
Time = 0.41 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.18 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=-\frac {\cos (2 a-c+2 b x-d x)}{4 (2 b-d)}+\frac {\cos (2 a+c+(2 b+d) x)}{4 (2 b+d)}+\frac {1}{2} \left (-\frac {\cos (c) \cos (d x)}{d}+\frac {\sin (c) \sin (d x)}{d}\right ) \]
-1/4*Cos[2*a - c + 2*b*x - d*x]/(2*b - d) + Cos[2*a + c + (2*b + d)*x]/(4* (2*b + d)) + (-((Cos[c]*Cos[d*x])/d) + (Sin[c]*Sin[d*x])/d)/2
Time = 0.24 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {5080, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \sin ^2(a+b x) \sin (c+d x) \, dx\) |
\(\Big \downarrow \) 5080 |
\(\displaystyle \int \left (\frac {1}{4} \sin (2 a+x (2 b-d)-c)-\frac {1}{4} \sin (2 a+x (2 b+d)+c)+\frac {1}{2} \sin (c+d x)\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle -\frac {\cos (2 a+x (2 b-d)-c)}{4 (2 b-d)}+\frac {\cos (2 a+x (2 b+d)+c)}{4 (2 b+d)}-\frac {\cos (c+d x)}{2 d}\) |
-1/4*Cos[2*a - c + (2*b - d)*x]/(2*b - d) - Cos[c + d*x]/(2*d) + Cos[2*a + c + (2*b + d)*x]/(4*(2*b + d))
3.3.2.3.1 Defintions of rubi rules used
Int[Sin[v_]^(p_.)*Sin[w_]^(q_.), x_Symbol] :> Int[ExpandTrigReduce[Sin[v]^p *Sin[w]^q, x], x] /; ((PolynomialQ[v, x] && PolynomialQ[w, x]) || (Binomial Q[{v, w}, x] && IndependentQ[Cancel[v/w], x])) && IGtQ[p, 0] && IGtQ[q, 0]
Time = 0.56 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.93
method | result | size |
default | \(-\frac {\cos \left (2 a -c +\left (2 b -d \right ) x \right )}{4 \left (2 b -d \right )}-\frac {\cos \left (d x +c \right )}{2 d}+\frac {\cos \left (2 a +c +\left (2 b +d \right ) x \right )}{8 b +4 d}\) | \(63\) |
parallelrisch | \(\frac {\left (-2 b d -d^{2}\right ) \cos \left (2 a -c +\left (2 b -d \right ) x \right )+\left (2 b d -d^{2}\right ) \cos \left (2 a +c +\left (2 b +d \right ) x \right )+\left (-8 b^{2}+2 d^{2}\right ) \cos \left (d x +c \right )+8 b^{2}}{16 b^{2} d -4 d^{3}}\) | \(92\) |
risch | \(-\frac {2 \cos \left (d x +c \right ) b^{2}}{\left (2 b +d \right ) \left (2 b -d \right ) d}+\frac {d \cos \left (d x +c \right )}{2 \left (2 b +d \right ) \left (2 b -d \right )}-\frac {\cos \left (2 x b -d x +2 a -c \right ) b}{2 \left (2 b +d \right ) \left (2 b -d \right )}-\frac {d \cos \left (2 x b -d x +2 a -c \right )}{4 \left (2 b +d \right ) \left (2 b -d \right )}+\frac {\cos \left (2 x b +d x +2 a +c \right ) b}{2 \left (2 b +d \right ) \left (2 b -d \right )}-\frac {d \cos \left (2 x b +d x +2 a +c \right )}{4 \left (2 b +d \right ) \left (2 b -d \right )}\) | \(191\) |
norman | \(\frac {-\frac {4 b^{2}}{d \left (4 b^{2}-d^{2}\right )}-\frac {4 b^{2} \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{4}}{d \left (4 b^{2}-d^{2}\right )}-\frac {8 b \tan \left (\frac {a}{2}+\frac {x b}{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 b^{2}-d^{2}}+\frac {8 b \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{3} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 b^{2}-d^{2}}-\frac {4 d \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{4 b^{2}-d^{2}}+\frac {2 \left (-4 b^{2}+2 d^{2}\right ) \tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{2}}{d \left (4 b^{2}-d^{2}\right )}}{\left (1+\tan \left (\frac {a}{2}+\frac {x b}{2}\right )^{2}\right )^{2} \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}\) | \(234\) |
Time = 0.25 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.01 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=-\frac {2 \, b d \cos \left (b x + a\right ) \sin \left (b x + a\right ) \sin \left (d x + c\right ) + {\left (d^{2} \cos \left (b x + a\right )^{2} + 2 \, b^{2} - d^{2}\right )} \cos \left (d x + c\right )}{4 \, b^{2} d - d^{3}} \]
-(2*b*d*cos(b*x + a)*sin(b*x + a)*sin(d*x + c) + (d^2*cos(b*x + a)^2 + 2*b ^2 - d^2)*cos(d*x + c))/(4*b^2*d - d^3)
Leaf count of result is larger than twice the leaf count of optimal. 410 vs. \(2 (49) = 98\).
Time = 0.70 (sec) , antiderivative size = 410, normalized size of antiderivative = 6.03 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=\begin {cases} x \sin ^{2}{\left (a \right )} \sin {\left (c \right )} & \text {for}\: b = 0 \wedge d = 0 \\\frac {x \sin ^{2}{\left (a - \frac {d x}{2} \right )} \sin {\left (c + d x \right )}}{4} - \frac {x \sin {\left (a - \frac {d x}{2} \right )} \cos {\left (a - \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{2} - \frac {x \sin {\left (c + d x \right )} \cos ^{2}{\left (a - \frac {d x}{2} \right )}}{4} + \frac {3 \sin {\left (a - \frac {d x}{2} \right )} \sin {\left (c + d x \right )} \cos {\left (a - \frac {d x}{2} \right )}}{2 d} - \frac {\cos ^{2}{\left (a - \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{d} & \text {for}\: b = - \frac {d}{2} \\\frac {x \sin ^{2}{\left (a + \frac {d x}{2} \right )} \sin {\left (c + d x \right )}}{4} + \frac {x \sin {\left (a + \frac {d x}{2} \right )} \cos {\left (a + \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{2} - \frac {x \sin {\left (c + d x \right )} \cos ^{2}{\left (a + \frac {d x}{2} \right )}}{4} - \frac {\sin ^{2}{\left (a + \frac {d x}{2} \right )} \cos {\left (c + d x \right )}}{d} + \frac {\sin {\left (a + \frac {d x}{2} \right )} \sin {\left (c + d x \right )} \cos {\left (a + \frac {d x}{2} \right )}}{2 d} & \text {for}\: b = \frac {d}{2} \\\left (\frac {x \sin ^{2}{\left (a + b x \right )}}{2} + \frac {x \cos ^{2}{\left (a + b x \right )}}{2} - \frac {\sin {\left (a + b x \right )} \cos {\left (a + b x \right )}}{2 b}\right ) \sin {\left (c \right )} & \text {for}\: d = 0 \\- \frac {2 b^{2} \sin ^{2}{\left (a + b x \right )} \cos {\left (c + d x \right )}}{4 b^{2} d - d^{3}} - \frac {2 b^{2} \cos ^{2}{\left (a + b x \right )} \cos {\left (c + d x \right )}}{4 b^{2} d - d^{3}} - \frac {2 b d \sin {\left (a + b x \right )} \sin {\left (c + d x \right )} \cos {\left (a + b x \right )}}{4 b^{2} d - d^{3}} + \frac {d^{2} \sin ^{2}{\left (a + b x \right )} \cos {\left (c + d x \right )}}{4 b^{2} d - d^{3}} & \text {otherwise} \end {cases} \]
Piecewise((x*sin(a)**2*sin(c), Eq(b, 0) & Eq(d, 0)), (x*sin(a - d*x/2)**2* sin(c + d*x)/4 - x*sin(a - d*x/2)*cos(a - d*x/2)*cos(c + d*x)/2 - x*sin(c + d*x)*cos(a - d*x/2)**2/4 + 3*sin(a - d*x/2)*sin(c + d*x)*cos(a - d*x/2)/ (2*d) - cos(a - d*x/2)**2*cos(c + d*x)/d, Eq(b, -d/2)), (x*sin(a + d*x/2)* *2*sin(c + d*x)/4 + x*sin(a + d*x/2)*cos(a + d*x/2)*cos(c + d*x)/2 - x*sin (c + d*x)*cos(a + d*x/2)**2/4 - sin(a + d*x/2)**2*cos(c + d*x)/d + sin(a + d*x/2)*sin(c + d*x)*cos(a + d*x/2)/(2*d), Eq(b, d/2)), ((x*sin(a + b*x)** 2/2 + x*cos(a + b*x)**2/2 - sin(a + b*x)*cos(a + b*x)/(2*b))*sin(c), Eq(d, 0)), (-2*b**2*sin(a + b*x)**2*cos(c + d*x)/(4*b**2*d - d**3) - 2*b**2*cos (a + b*x)**2*cos(c + d*x)/(4*b**2*d - d**3) - 2*b*d*sin(a + b*x)*sin(c + d *x)*cos(a + b*x)/(4*b**2*d - d**3) + d**2*sin(a + b*x)**2*cos(c + d*x)/(4* b**2*d - d**3), True))
Leaf count of result is larger than twice the leaf count of optimal. 371 vs. \(2 (62) = 124\).
Time = 0.24 (sec) , antiderivative size = 371, normalized size of antiderivative = 5.46 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=-\frac {{\left (2 \, b d \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \cos \left ({\left (2 \, b + d\right )} x + 2 \, a + 2 \, c\right ) + {\left (2 \, b d \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \cos \left ({\left (2 \, b + d\right )} x + 2 \, a\right ) - {\left (2 \, b d \cos \left (c\right ) + d^{2} \cos \left (c\right )\right )} \cos \left (-{\left (2 \, b - d\right )} x - 2 \, a + 2 \, c\right ) - {\left (2 \, b d \cos \left (c\right ) + d^{2} \cos \left (c\right )\right )} \cos \left (-{\left (2 \, b - d\right )} x - 2 \, a\right ) - 2 \, {\left (4 \, b^{2} \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \cos \left (d x + 2 \, c\right ) - 2 \, {\left (4 \, b^{2} \cos \left (c\right ) - d^{2} \cos \left (c\right )\right )} \cos \left (d x\right ) + {\left (2 \, b d \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \sin \left ({\left (2 \, b + d\right )} x + 2 \, a + 2 \, c\right ) - {\left (2 \, b d \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \sin \left ({\left (2 \, b + d\right )} x + 2 \, a\right ) - {\left (2 \, b d \sin \left (c\right ) + d^{2} \sin \left (c\right )\right )} \sin \left (-{\left (2 \, b - d\right )} x - 2 \, a + 2 \, c\right ) + {\left (2 \, b d \sin \left (c\right ) + d^{2} \sin \left (c\right )\right )} \sin \left (-{\left (2 \, b - d\right )} x - 2 \, a\right ) - 2 \, {\left (4 \, b^{2} \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \sin \left (d x + 2 \, c\right ) + 2 \, {\left (4 \, b^{2} \sin \left (c\right ) - d^{2} \sin \left (c\right )\right )} \sin \left (d x\right )}{8 \, {\left ({\left (\cos \left (c\right )^{2} + \sin \left (c\right )^{2}\right )} d^{3} - 4 \, {\left (b^{2} \cos \left (c\right )^{2} + b^{2} \sin \left (c\right )^{2}\right )} d\right )}} \]
-1/8*((2*b*d*cos(c) - d^2*cos(c))*cos((2*b + d)*x + 2*a + 2*c) + (2*b*d*co s(c) - d^2*cos(c))*cos((2*b + d)*x + 2*a) - (2*b*d*cos(c) + d^2*cos(c))*co s(-(2*b - d)*x - 2*a + 2*c) - (2*b*d*cos(c) + d^2*cos(c))*cos(-(2*b - d)*x - 2*a) - 2*(4*b^2*cos(c) - d^2*cos(c))*cos(d*x + 2*c) - 2*(4*b^2*cos(c) - d^2*cos(c))*cos(d*x) + (2*b*d*sin(c) - d^2*sin(c))*sin((2*b + d)*x + 2*a + 2*c) - (2*b*d*sin(c) - d^2*sin(c))*sin((2*b + d)*x + 2*a) - (2*b*d*sin(c ) + d^2*sin(c))*sin(-(2*b - d)*x - 2*a + 2*c) + (2*b*d*sin(c) + d^2*sin(c) )*sin(-(2*b - d)*x - 2*a) - 2*(4*b^2*sin(c) - d^2*sin(c))*sin(d*x + 2*c) + 2*(4*b^2*sin(c) - d^2*sin(c))*sin(d*x))/((cos(c)^2 + sin(c)^2)*d^3 - 4*(b ^2*cos(c)^2 + b^2*sin(c)^2)*d)
Time = 0.28 (sec) , antiderivative size = 61, normalized size of antiderivative = 0.90 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=\frac {\cos \left (2 \, b x + d x + 2 \, a + c\right )}{4 \, {\left (2 \, b + d\right )}} - \frac {\cos \left (2 \, b x - d x + 2 \, a - c\right )}{4 \, {\left (2 \, b - d\right )}} - \frac {\cos \left (d x + c\right )}{2 \, d} \]
1/4*cos(2*b*x + d*x + 2*a + c)/(2*b + d) - 1/4*cos(2*b*x - d*x + 2*a - c)/ (2*b - d) - 1/2*cos(d*x + c)/d
Time = 20.68 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.54 \[ \int \sin ^2(a+b x) \sin (c+d x) \, dx=-\frac {d^2\,\cos \left (2\,a+c+2\,b\,x+d\,x\right )-b\,\left (2\,d\,\cos \left (2\,a+c+2\,b\,x+d\,x\right )-2\,d\,\cos \left (2\,a-c+2\,b\,x-d\,x\right )\right )+d^2\,\cos \left (2\,a-c+2\,b\,x-d\,x\right )}{16\,b^2\,d-4\,d^3}-\frac {\cos \left (c+d\,x\right )}{2\,d} \]